package com.wanxi.inter;

public class Circle implements CompareObject {
    private double radius;

    public Circle(double radi) {
        this.radius = radi;
    }


    @Override
    public int compareTo(Object o) throws Exception{
        if (this == o) {
            return 0;
        } else if (o instanceof Circle) {
            Circle circle = (Circle) o;
            if (this.radius > circle.radius) {
                return 1;
            } else if (this.radius < circle.radius) {
                return -1;
            } else {
                return 0;
            }

        } else {
            throw new Exception("输入对象类型不匹配");
        }
    }
}
